use crate::error_info::process_error_info;
use proc_macro::TokenStream;
use syn::{DeriveInput, parse_macro_input};

mod error_info;

#[proc_macro_derive(ToErrorInfo, attributes(error_info))]
pub fn derive_to_error_info(input: TokenStream) -> TokenStream {
    //quote! return proc-macro2 tokenStream so we need convert it to TokenSteam
    let input = parse_macro_input!(input as DeriveInput);
    // println!("{:#?}",input);
    //enum ident type
    process_error_info(input).into()
}

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}
